
*********************************************************************************
*This file analyzes MMF LPI
*********************************************************************************

cd ".."

***********************************************************************************
*Figure 8 
***********************************************************************************

use "data_intermediate/mmf_ltisample_haircutrobust_new.dta", clear

keep if prime==1 | muni==1

collapse (mean)  sa_mf_cash flow_trunc lpi, by (insti tm)

drop if tm<monthly("2014m01", "YM")


replace lpi=lpi*10000

line lpi tm if insti==0 || line lpi tm if insti==1 ||, xline(681, lpattern(dash) lcolor(black))  xline(669, lcolor(black)) xline(696, lcolor(black))   ytitle("Liquidity Provision Index")  xtitle("")  ylabel(, nogrid) graphregion(color(white)) bgcolor(white)  legend(label(1 "Retail") label(2 "Institutional (Fixed NAV)") label(3 "Institutional (Flexible NAV)") region(col(white)))
graph export "output/mmmftrends_lpi.pdf", replace

 
line sa_mf_cash tm if insti==0 || line sa_mf_cash tm if insti==1 ||, xline(681, lpattern(dash) lcolor(black))  xline(669, lcolor(black)) xline(696, lcolor(black))   yscale (range( 0 0.25))  ytitle("Cash Proportion")  xtitle("")  ylabel(, nogrid) graphregion(color(white)) bgcolor(white)  legend(label(1 "Retail") label(2 "Institutional") region(col(white)))
graph export "output/mmmftrends_cash.pdf", replace


***********************************************************************************
*Regression
***********************************************************************************

use "data_intermediate/mmf_ltisample_haircutrobust_new.dta", clear

keep if prime==1 | muni==1


gen post=0 if tm>monthly("2013m12", "YM") & tm<monthly("2015m10", "YM")
replace post=1  if tm>monthly("2017m12", "YM") & tm<monthly("2019m10", "YM")

drop if post==. 


collapse (mean) lpi , by (fundcode insti post)

gen dum=1 if post==1 & insti==1
replace dum=0 if dum==.


label variable post "Post Reform"
label variable insti "Institutional Fund"
label variable dum  "Post Reform * Institutional Fund"

replace lpi=lpi*10000

eststo clear

eststo:reg lpi post insti dum, cluster(fundcode)

*Balanced Sample

use "data_intermediate/mmf_ltisample_haircutrobust_new.dta", clear

keep if prime==1 | muni==1


gen post=0 if tm>monthly("2013m12", "YM") & tm<monthly("2015m10", "YM")
replace post=1  if tm>monthly("2017m12", "YM") & tm<monthly("2019m10", "YM")


sort fundcode post
by fundcode: gen dum=1 if post[1]==1
by fundcode: replace dum=1 if post[_N]==0
drop if dum==1

drop if post==.

collapse (mean) lpi , by (fundcode insti post)

gen dum=1 if post==1 & insti==1
replace dum=0 if dum==.


label variable post "Post Reform"
label variable insti "Institutional Fund"
label variable dum  "Post Reform * Institutional Fund"

replace lpi=lpi*10000


eststo:reg lpi post insti dum, cluster(fundcode)

*Earlier Start of Pre

use "data_intermediate/mmf_ltisample_haircutrobust_new.dta", clear

keep if prime==1 | muni==1


gen post=0 if tm>monthly("2013m12", "YM") & tm<monthly("2015m10", "YM")
replace post=1  if tm>monthly("2018m12", "YM") & tm<monthly("2019m10", "YM")

drop if post==. 

collapse (mean) lpi , by (fundcode insti post)

gen dum=1 if post==1 & insti==1
replace dum=0 if dum==.


label variable post "Post Reform"
label variable insti "Institutional Fund"
label variable dum  "Post Reform * Institutional Fund"

replace lpi=lpi*10000


eststo:reg lpi post insti dum, cluster(fundcode)

*Later Start of Post

use "data_intermediate/mmf_ltisample_haircutrobust_new.dta", clear

keep if prime==1 | muni==1


gen post=0 if tm>monthly("2013m12", "YM") & tm<monthly("2015m10", "YM")
replace post=1  if tm>monthly("2018m05", "YM") & tm<monthly("2019m10", "YM")
drop if post==. 


collapse (mean) lpi , by (fundcode insti post)

gen dum=1 if post==1 & insti==1
replace dum=0 if dum==.


label variable post "Post Reform"
label variable insti "Institutional Fund"
label variable dum  "Post Reform * Institutional Fund"

replace lpi=lpi*10000

eststo:reg lpi post insti dum, cluster(fundcode)

capture: esttab using  "output/mmmfreform_new.tex", ///
replace b(2) se(2) star(* 0.10 ** 0.05 *** 0.01  )  ///
mtitles("LPI" "LPI" "LPI" "LPI" )   ///
ar2  br  label  nonotes  s( N r2_a, ///
label( "Observations" "Adj. R-squared") ///
 fmt( 0 2  %9.0fc 3 )) width(\hsize)  













